﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;
using JKF.DataModule.IDAL;
using JKF.Substructure;
using System.Data.SqlClient;//请先添加引用
namespace JKF.DataModule.SqlServerDAL
{
    public partial class dalSYS_PARAM : IdalSYS_PARAM
    {
        /// <summary>
        /// 获取系统设置的金额对应积分的比例
        /// </summary>
        /// <returns></returns>
        public static string GetPointRate()
        {
            var dt = DB.HR.ExecuteDataSet(CommandType.Text,
                                     "IF EXISTS(SELECT VAL  FROM dbo.SYS_PARAM_VALUE WHERE PARAM_KEY='CONSUMPTION_POINTS') SELECT VAL  FROM dbo.SYS_PARAM_VALUE WHERE PARAM_KEY='CONSUMPTION_POINTS' AND UNIT_KEY IS NULL ELSE  SELECT VAL_DEFAULT FROM dbo.SYS_PARAM WHERE PARAM_KEY='CONSUMPTION_POINTS'")
                    .Tables[0];
            return (dt != null && dt.Rows.Count > 0) ? dt.Rows[0][0].ToString() : "1";
        }
    }
}
